//2009/08/14 03:12:36
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class YahtzeeScore
{
public:
    int maxPoints(vector <int> toss)
    {
		int res = 0;
		for(int i=0; i<toss.size(); i++)
		{
			int score = toss[i];
			for(int j=i+1; j<toss.size(); j++)
			{
				if(toss[i]==toss[j])
					score += toss[j];
			}
			res = max(res, score);
		}
		return res;
    }
};
